package com.BlackHourse.P1.demo1;

import java.util.Scanner;

public class OperatorDemo {
    public static void main(String[] args) {
        //创建对象
//        Scanner scanner = new Scanner(System.in);
//        System.out.println("请输入要求和的的数的个数:");
//        int max = scanner.nextInt();
//
//        int sum = 0;

        //找出来所有的水仙花数字
        for(int i =100;i<1000;i++){
            //找出来各个的个位数信息
            int ge = i%10;
            int bai = i/100;
            int ten = i/10%10;
//            System.out.println(ten);
            if(ge*ge*ge+bai*bai*bai+ten*ten*ten == i){
                System.out.println(i+"是水仙花数");
            }
        }
        System.out.println("---------------分割线---------------");
        //while循环找出来水仙花数
        int j = 100;
        while(j<1000){
            //定义水仙花数各个位置的内容
            int ge = j%10;
            int bai = j/100;
            int ten = j/10%10;

            if(ge*ge*ge+bai*bai*bai+ten*ten*ten == j){
                System.out.println(j+"是水仙花数");
            }
            j++;
        }
    }
}
